/**
* 贷后管理路由
**/
'use strict';
import traceCtl from './trace'

import collectionCtl from './collection'//催收管理

import planCtl from './plan'//回款计划

import detailCtl from './detail'//查看订单

module.exports = angular.module('app.loanlater', []).config(function($stateProvider) {
    $stateProvider.state('loanlater', {
        url: '/loanlater',
        templateProvider: function($q) {
            var deferred = $q.defer();
            require.ensure(['../layout.html'], function(require) {
                var template = require('../layout.html');
                deferred.resolve(template);
            }, 'loanlater-tpl');
            return deferred.promise;
        },
        controller: 'loanlaterCtrl',
        controllerAs: 'vm',
        resolve: {
            'app.loanlater': function($q, $ocLazyLoad) {
                var deferred = $q.defer();
                require.ensure(['./index.js'], function() {
                    var mod = require('./index.js');
                    $ocLazyLoad.load({
                        name: 'app.loanlater'
                    });
                    deferred.resolve(mod.controller);
                }, 'loanlater-ctl');
                return deferred.promise;
            }
        }
    })
    .state('loanlater.detail', {
        url: '/detail?oid?pid?s_id',//查看订单
        views: {
            'content': {
                templateProvider: function($q) {
                    var deferred = $q.defer();
                    require.ensure(['./detail/index.html'], function(require) {
                        var template = require('./detail/index.html');
                        deferred.resolve(template);
                    }, 'loanlater.detail-tpl');
                    return deferred.promise;
                },
                controller:detailCtl
            }
        }
    })
    .state('loanlater.trace', {
        url: '/trace',
        views: {
            'content': {
                templateProvider: function($q) {
                    var deferred = $q.defer();
                    require.ensure(['./trace/index.html'], function(require) {
                        var template = require('./trace/index.html');
                        deferred.resolve(template);
                    }, 'loanlater.trace-tpl');
                    return deferred.promise;
                },
                controller:traceCtl
            }
        }
    })
    .state('loanlater.plan', {
        url: '/trace/plan',
        views: {
            'content': {
                templateProvider: function($q) {
                    var deferred = $q.defer();
                    require.ensure(['./plan/index.html'], function(require) {
                        var template = require('./plan/index.html');
                        deferred.resolve(template);
                    }, 'loanlater.plan-tpl');
                    return deferred.promise;
                },
                controller:planCtl
            }
        }
    })
    .state('loanlater.collection', {
        url: '/collection',
        views: {
            'content': {
                templateProvider: function($q) {
                    var deferred = $q.defer();
                    require.ensure(['./collection/index.html'], function(require) {
                        var template = require('./collection/index.html');
                        deferred.resolve(template);
                    }, 'loanlater.collection-tpl');
                    return deferred.promise;
                },
                controller:collectionCtl
            }
        }
    })
}).name;
